/**
 *
 * @author
 *
 */
class OpPageSelect extends OpPage {

    private _bgSprite: egret.Bitmap;
    private _touchEnabled: Boolean = false;

    public constructor() {
        super();

        this._bgSprite = new egret.Bitmap();
        this._bgSprite.texture = RES.getRes('page/op-select.jpg');
        this._bgSprite.width = 1200;
        this._bgSprite.height = 750;
        this._bgSprite.x = 0;
        this._bgSprite.y = 0;
        this.addChild(this._bgSprite);
    }

    public enableTouch(): void {
        this._touchEnabled = true;
    }

    public oneTouch(event: egret.TouchEvent): void {

        function touch(type: number) {
            if(this._touchEnabled) {
                this._touchEnabled = false;
                EventBus.trigger('OP_PLAY_ROLE',type);
            }
        }

        if(event.stageX > 200 && event.stageX < 400 &&
            event.stageY > 330 && event.stageY < 630) {
            touch.call(this,0);
        } else if(event.stageX > 530 && event.stageX < 730 &&
            event.stageY > 330 && event.stageY < 630) {
            touch.call(this,2);
        } else if(event.stageX > 870 && event.stageX < 1070 &&
            event.stageY > 330 && event.stageY < 630) {
            touch.call(this,1);
        } else {
            // Do nothing
        }

    }
}
